#人生苦短，我用python

import  requests
import hashlib

#md5是单向加密，不可逆
def make_password(mypass,salt):

    #生成对象
    md5 = hashlib.md5()
    #定义加密对象
    sign_str = mypass + salt
    #d转码
    sign_str8 = str(sign_str).encode(encoding='utf-8')
    #加密
    md5.update(sign_str8)
    #生成密文
    md5_server = md5.hexdigest()

    return md5_server

# print(make_password('123'))


#post测试
import requests

data = {'username': 'admin', 'password': '123'}

res = requests.post('http://127.0.0.1:8000/login/', data=data)

print(res.text)
#get测试 !区别post用data，get用params
data = {'username':'admin123','password':'123'}
res = requests.get('http://127.0.0.1:8000/register/',params=data)
print(res.text)